import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 引入element ui
import "./plugins/element.js"
import "element-ui/lib/theme-chalk/index.css"
import "./assets/css/global.css"
// 引入axios
import axios from 'axios'
// 添加axios默认地址
axios.defaults.baseURL=`http://127.0.0.1:8888/api/private/v1/`;
// 把axios绑定到vue原型链上
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  const token = sessionStorage.getItem('token')
  if(token){
    config.headers.Authorization = token;

  }
  return config;
});
Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
